FIND_PACKAGE(CSharp REQUIRED)
UNSET(TARGET_SWIGFLAGS)

include(ShogunInterfaces)

GENERATE_INTERFACE_TARGET(csharp ${CMAKE_CURRENT_SOURCE_DIR} "")

ADD_CUSTOM_COMMAND(TARGET interface_csharp
				   POST_BUILD
				   COMMAND "${CSHARP_COMPILER}" /t:library *.cs /out:shogun.dll
				   COMMENT "Creating shogun.dll")
IF(NOT CSHARP_INSTALL_DIR)
	SET(CSHARP_INSTALL_DIR "lib/cli/shogun")
ENDIF(NOT CSHARP_INSTALL_DIR)

SET(INTERFACE_CSHARP_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE)
INSTALL(TARGETS interface_csharp
	LIBRARY DESTINATION ${CSHARP_INSTALL_DIR}
	COMPONENT csharp)

INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/shogun.dll
		DESTINATION ${CSHARP_INSTALL_DIR}
		COMPONENT csharp)
